﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Text.RegularExpressions;

namespace GoogleSearch.Model
{
    public class GoogleSearchResult
    {
        const string THUMBNAIL_URL = "http://image.picoshot.com/thumbnail.php?url=";
        const string HTML_TAG_PATTERN = "<.*?>";
        string _content;

        public string UnescapedUrl { get; set; }
        public string Url { get; set; }
        public string VisibleUrl { get; set; }
        public string TitleNoFormatting { get; set; }
        public string Content { get { return stripHTML(_content); } set { _content = value; } }
        public string ThumbnailUrl { get { return THUMBNAIL_URL + Url; } }              

        static string stripHTML(string inputString)
        {
            return Regex.Replace
              (inputString, HTML_TAG_PATTERN, string.Empty);
        }
    }
}
